<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>西南石油大学电子邮件系统</title>
    <link rel="stylesheet" href="css/login.css">
    <script>
        function getCookie(name)
        {
            var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
            if(arr=document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return "";
        }
        function checkCookie(){
            var username=getCookie("username");
            var userpwd=getCookie("userpwd");
            if(username != "" && userpwd != ""){
                document.getElementById('account').value=username;
                document.getElementById('password').value=userpwd;
            }
        }

        window.onload=function()//用window的onload事件，窗体加载完毕的时候
        {
            checkCookie();
        }
    </script>
</head>

<body>
    <div class="header">
        <div class="logo">
            <img src="images/login_logo.png" alt="">
        </div>
        <a href="" class="btn_help">帮助</a>
    </div>
    <div class="content">
        <div class="login">
            <div class="login_title" >账号登录</div>
            <div class="login_body">
                <h4 class="login_tip" id="log_tip">用户登录</h4>
                <form action="LoginServlet" id="login_form" method="post">
                    <input type="text" placeholder="用户名" id="account" name="username">
                    <input type="password" placeholder="密码" id="password" name="password">
                    <div class="login_help">
                        <p>学生选择@stu.swpu.edu.cn</p>
                        <a href="">忘记密码</a>
                    </div>
                    <input type="button" value="登录" id="btn_login" >
                </form>
            </div>
        </div>
    </div>
    <div class="footer">
        西南石油大学
    </div>
    <script src="js/login.js"></script>
</body>

</html>